home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / lib232.zip / SALT.DOC < prev    next >
Text File  |  1990-10-14  |  28KB  |  582 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                SALT.DOC Copyright (C) 1990 Liberation Enterprises.
  7.                    An introduction to Telix's script language.
  8.  
  9.  
  10.      This is not a comprehensive SALT tutor, and if you are seeking such you
  11.      won't find it here (a more extensive tutor will most likely be released
  12.      in the future).  If you understand the logon scripts provided with
  13.      Telix, then you will probably be wasting your time reading this.  This
  14.      document was designed for beginners, and simply explains some basics of
  15.      SALT, for Telix v3, and some easy-to-use but useful functions. 
  16.      Everything is explained in simple terms, to enable non-programmers or
  17.      new Telix users to write usable scripts.  You will also be shown how to
  18.      make use of the SALT manual.
  19.  
  20.      Learning SALT is usually the only major obstacle people run into with
  21.      Telix.  As I'm sure you are aware, SALT is one of, if not the most
  22.      powerful 'script' language available for any communications program. 
  23.      Unfortunately, extra power usually translates into a more involved
  24.      learning process--the more power (or features) you have, the more there
  25.      is to learn.  However, you need not learn the entire language and study
  26.      the entire SALT manual to create useful scripts.  There are a few SALT
  27.      statements and functions listed below, that will enable you to automate
  28.      fairly complex tasks, without getting into any major programming.  The
  29.      functions are:
  30.  
  31.      capture();     Open, close, or pause a capture file.  Specify the name
  32.                     of the capture file between double quotes (e.g.
  33.                     capture("TELIX.CAP").  If you don't specify a path,
  34.                     Telix creates the file in the same directory as
  35.                     TELIX.EXE.  See CAPCMD.SLT for example usage of
  36.                     capture().
  37.      cputs();       Put a 'string' of text out the communications port
  38.                     (cputs is 'c' for communications port (modem), 'put'
  39.                     for... put, 's' for string.  A string is just a bunch of
  40.                     characters grouped together between double quotes; a
  41.                     sentence (e.g. "This is a string").
  42.      delay_scr();   Pause the script from running for a certain amount of
  43.                     time.  This is similar to delay(), but it allows the
  44.                     screen to be updated with incoming characters for the
  45.                     duration of the delay.  Delays can be used to wait for a
  46.                     prompt, etc.
  47.      dos();         Gives you access to DOS from within a Telix script. 
  48.                     'Access to DOS' means you can carry out a simple DOS
  49.                     command, such as COPY, DEL, etc., or you can even run
  50.                     another program if necessary.  The command must be
  51.                     placed between double quotes.  Examples:
  52.                       dos("DEL TEST.FIL"); ...or... dos("123.EXE");
  53.      goto <label>   A script or program normally runs from top to bottom, or
  54.                     from the first statement to the last.  To change this,
  55.                     and skip immediately to another section of the script,
  56.                     you use 'goto's.
  57.      hangup();      Breaks the connection by hanging up.
  58.      return();      End the current 'function' right where we are, and
  59.                     return to the 'caller'.  The 'caller' depends on where
  60.                     the return() is found.  If you return() from the main()
  61.  
  62.  
  63.  
  64.  
  65.      The  L i b e r a t o r  v2.32                         SALT.DOC - Page 2
  66.      
  67.      
  68.  
  69.                     function that all scripts start at, then you return to
  70.                     the calling script (The Liberator, etc.) or to Telix
  71.                     terminal mode.  The Liberator tests any value you
  72.                     return() from your script's main() function.
  73.      waitfor();     Wait for some text to come in from the BBS, or until a
  74.                     specified number of seconds elapses.  Combined with
  75.                     cputs(), this is a very useful function and can automate
  76.                     many tasks.
  77.  
  78.      Two other useful functions are:
  79.  
  80.      send();        Send a file to the BBS (upload)
  81.      receive();     Receive a file from the BBS (download)
  82.  
  83.      You can write many useful scripts using just these functions.  However,
  84.      your scripts wouldn't be capable of making any intelligent decisions
  85.      using just the above... For example, waitfor() allows you to wait for a
  86.      specified number of seconds for a certain message or prompt to come in
  87.      from the BBS; but what if the message doesn't come in?  You don't want
  88.      to answer a question if the question hasn't even been asked, so you
  89.      must have some way to test whether the text came in or not.  This is
  90.      where these two statements come into play:
  91.  
  92.      if()       Tests whether something is TRUE (successful) or FALSE
  93.                 (unsuccessful).
  94.      while()    Does something 'while' a certain condition is TRUE.
  95.  
  96.      What's all this about TRUE and FALSE?  How do these things 'test'
  97.      whether something is successful (TRUE) or unsuccessful (FALSE)?  There
  98.      is just a simple rule that they follow, which says that: "TRUE is
  99.      anything that is not zero".  The number 1 is TRUE, since it is not
  100.      zero, the letter 'A' must be TRUE since it is not zero... 1 + 1 (one
  101.      plus one) is TRUE, since it's end result is not zero, etc.  "FALSE is
  102.      anything that does end up to be zero"... 0 itself is FALSE, 1 - 1 (one
  103.      minus one) is FALSE since its end result is zero.
  104.  
  105.      This doesn't have to make sense... (and it certainly didn't for me at
  106.      first) that's just the way it is.  Anything that results in a zero
  107.      value is considered FALSE, anything that results in a non-zero value is
  108.      considered TRUE.  If something is FALSE, it is also known as unsuccess-
  109.      ful, or 'not' successful.  'Not' is used in SALT to refer to something
  110.      that is not TRUE: if it's "not TRUE", it must be FALSE, or zero.  I'm
  111.      attempting to burn this into your memory since it is used all over the
  112.      place in SALT and is important to pick up.  The true/false rule makes
  113.      scripts 'smart' enough to carry out meaningful decisions.  Almost
  114.      everything in SALT evaluates to TRUE or FALSE and can be tested with
  115.      if() and while().  Just using TRUE and FALSE was enough to create The
  116.      Liberator, and many of the other programs you use.
  117.  
  118.      If I had some money, how much do I have?  I have TRUE amount of money
  119.      (it must be TRUE since it isn't zero...).  To test the value in SALT, I
  120.      could use:
  121.  
  122.      if (money)
  123.  
  124.  
  125.  
  126.  
  127.      The  L i b e r a t o r  v2.32                         SALT.DOC - Page 3
  128.      
  129.      
  130.  
  131.      ...which is the same as saying "if money is TRUE"...  Of course, it
  132.      wouldn't do much good just to know this unless I was going to do
  133.      something with the information, like this:
  134.  
  135.      if (money)
  136.       spend();
  137.  
  138.      This is how if() operates.  'If' whatever is between the brackets ends
  139.      up to be TRUE (not zero), then the next statement (up to the first
  140.      semicolon) is carried out: spend(); in this case.  Then we move happily
  141.      along (by the way, scripts execute from top to bottom, unless told
  142.      otherwise).  If whatever is between if()'s brackets evaluates to FALSE
  143.      ('money' would be FALSE if it was equal to zero) then the statement
  144.      immediately following the if() is *skipped*.  [Don't try to compile
  145.      these examples... they're just nonsense used for demonstration.  Some
  146.      usable examples are given later.]
  147.  
  148.      if (this_is_TRUE)
  149.       then_do_this();
  150.  
  151.      The next line following an if() or while() is normally indented to show
  152.      that it may not get executed if the result is FALSE, and depends on the
  153.      if().  [Note that the SALT compiler doesn't care whether you indent or
  154.      not... in fact you could place an entire SALT script all on one line an
  155.      it will compile just fine.  Indending, and placing statements